package com.hoshiicloud.payment.util;

import java.io.IOException;
import java.io.InputStream;
import org.springframework.core.io.InputStreamResource;

/**
 * @program: hoshiicloud
 * @description:
 * @author: Mr.wu
 * @create: 2019-06-04 10:47
 **/
public class MultipartFileResource extends InputStreamResource {

    private String filename;
    private long size;

    public MultipartFileResource(String filename, long size, InputStream inputStream) {
        super(inputStream);
        this.size = size;
        this.filename = filename;
    }

    @Override
    public String getFilename() {
        return this.filename;
    }

    @Override
    public InputStream getInputStream() throws IOException, IllegalStateException {
        //To change body of generated methods, choose Tools | Templates.
        return super.getInputStream();
    }

    @Override
    public long contentLength() {
        return size;
    }
}
